import "@babel/polyfill";

// 这里是调试入口

import main from "./ActivePanel.vue";

const testComponent = {
  name: "test-component",
  template: '<div class="test-component"><slot>{{user.firstName}}</slot></div>',
  props: {
    user: {
      type: Object,
      default() {
        return { firstName: "default" };
      }
    }
  }
};
import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "first",
      component: {}
    },
    {
      path: "second",
      component: {}
    }
  ]
});

window.onpopstate = function(evn) {
  console.log("参数", evn.state);
  console.log("history", history.state);
};
window.onpushstate = function(evn) {
  console.log("参数", evn.state);
  console.log("history", history.state);
};

new Vue({
  el: "#app",
  components: {
    "batman-active-panel": main,
    "test-component": testComponent
  },
  data: {
    visible1: false,
    user: {
      firstName: "Batman",
      lastName: "Wynne"
    },
    visible2: false,
    visible3: false,
    visible4: false,
    visible5: false
  },
  methods: {
    visible2HistoryBack(lo) {
      this.visible2 = false;
    },
    visible5HistoryBack(){
      return false;
    }
  },
  router: router
});
